<?php
include '../mysqladmin.php';
$strName = $_POST["username"];
$strPassword = $_POST["password"];
$sql1 = "SELECT * FROM admin WHERE account='{$strName}'";
$okk = mysqli_query($link, $sql1);
if(!$okk->num_rows){
    $code["msg"] = "用户不存在！";
    $res = json_encode($code);
    echo $res;
    return;
}
$row = $okk->fetch_array();
if(!($row['password']==$strPassword)){
    $code["msg"] = "密码错误！";
    $res = json_encode($code);
    echo $res;
    return;
}else{
  $sql="delete from admin  where account='{$strName}'";
  $result = mysqli_query($link, $sql);
  if($result){
      $code["status"] = true;
      $code["msg"] = "注销成功！";
      $res = json_encode($code);
      echo $res;
  }else{
      $code["msg"] = $link->error;
      $res = json_encode($code);
      echo $res;
  }
}
mysqli_close($link);
?>